package com.kingwang.training.designpattern.observer.bo.jdk.flow;

import java.util.concurrent.Flow;
import java.util.concurrent.SubmissionPublisher;

public class Task {
    private SubmissionPublisher<Task> publisher = new SubmissionPublisher<>();

    private String title;

    private String content;

    public void setTitle(String title) {
        this.title = title;
        this.publisher.submit(this);
    }

    public void setContent(String content) {
        this.content = content;
        this.publisher.submit(this);
    }

    public void subscribe(Flow.Subscriber<? super Task> subscriber) {
        this.publisher.subscribe(subscriber);
    }
}
